Technical Q&A NW58
fBroadCastAddr Always Zero



Q:When I call OTInetGetInterfaceInfo, the fBroadcastAddr field always comes back as zero. Is this a bug?

A: Not really. The field describes how the broadcast address was configured. If it is zero, the broadcast address has not been explicitly configured. In this case, IP will synthesize a broadcast address based on the IP address and subnet mask.

If the broadcast address was explicitly configured, fBroadcastAddr will be the configured address. On current systems, the only time fBroadcastAddr is non-zero is when a DHCP server supplies it via DHCP option 28.

You can calculate the actual broadcast address being used with the following code.

broadcastAddr = info.fBroadcastAddr;
if (broadcastAddr == 0) {
    broadcastAddr = info.fAddress | ~info.fNetmask;
}

[Mar 08 1999]


Developer Documentation | Technical Notes | Development Kits | Sample Code